<template>
  <div class="home-container">
    <div class="header">
      <h1>欢迎页面</h1>
      <el-button @click="logout">退出登录</el-button>
    </div>

    <div class="welcome-message">
      <h2>欢迎回来，{{ userInfo?.username || '用户' }}！</h2>
      <p>您已成功登录系统</p>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from '@/stores/userStore';

const router = useRouter();
const userStore = useUserStore();

const userInfo = computed(() => userStore.userInfo);

const logout = () => {
  userStore.logout();
  router.push('/login');
};
</script>

<style scoped>
.home-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.welcome-message {
  text-align: center;
  padding: 40px 0;
}

.welcome-message h2 {
  font-size: 24px;
  margin-bottom: 15px;
}

.welcome-message p {
  font-size: 16px;
  color: #666;
}
</style> 